#!/bin/bash

cd "`dirname $0`"

BASEDST="distrib/fsroot"

# colors :
# 31 : removing
# 32 : copying
# 33 : cleaning
# 34 : creating archive

# <-- Deleting old plugins/libraries files
    for i in "plugins" "libraries"
    do
        if [ -d "${BASEDST}/data/SunOS/${i}" ]
        then
            echo -e -n "\x1b[1;31mRemoving ${BASEDST}/data/SunOS/${i}...\x1b[0m"
            rm -fr "${BASEDST}/data/SunOS/${i}"
            echo -e "\x1b[1;31mok\x1b[0m"
        fi

        mkdir -p "${BASEDST}/data/SunOS/${i}"
    done
# -->

# <-- Copying plugins
    [ -x plugins/copy_r.sh ] && ./plugins/copy_r.sh ../${BASEDST}
# -->

# <-- Copying libraries
    [ -x libraries/copy_r.sh ] && ./libraries/copy_r.sh ../${BASEDST}
# -->

# <-- Removing backup files
    echo -e -n "\x1b[1;31mRemoving backup files...\x1b[0m"
    ./rmbakfiles ${BASEDST}
    echo -e "\x1b[1;31mok\x1b[0m"
# -->

